<template>
    <el-dialog title="提示" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
        <el-form :label-position="labelPosition" label-width="80px" :model="formLabelAlign">
            <el-form-item label="课程ID">
                <el-input v-model="formLabelAlign.number"></el-input>
            </el-form-item>
            <el-form-item label="报名费">
                <el-input v-model="formLabelAlign.price"></el-input>
            </el-form-item>
            <el-form-item label="销量">
                <el-input v-model="formLabelAlign.sales"></el-input>
            </el-form-item>
            <el-form-item label="上传人">
                <el-input v-model="formLabelAlign.name"></el-input>
            </el-form-item>
            <el-form-item label="上传时间">
                <el-input v-model="formLabelAlign.date"></el-input>
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
            <el-button @click="dialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="upDate">确 定</el-button>
        </span>
    </el-dialog>
</template>

<script>
import eventBus from "../../../utils/eventBus";
export default {
    data() {
        return {
            dialogVisible: false,
            labelPosition: "right",
            formLabelAlign: {
                id: "",
                number: "",
                price: "",
                sales: "",
                name: "",
                date: "",
            },
        };
    },
    mounted() {
        eventBus.$on("edit", this.editNews);
    },
    methods: {
        upDate() {
            this.$emit("update", this.formLabelAlign);
            this.dialogVisible = false;
        },
        editNews(val) {
            this.dialogVisible = true;
            this.formLabelAlign = JSON.parse(JSON.stringify(val));
        },
        handleClose(done) {
            this.$confirm("确认关闭？")
                .then((_) => {
                    done();
                })
                .catch((_) => { });
        },
    },
};
</script>

<style>
</style>